<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>BIBLIO: /home/marco/workspace/biblio/src/comsock.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">BIBLIO
   
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">/home/marco/workspace/biblio/src/comsock.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="comsock_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00011"></a>00011 <span class="preprocessor">#ifndef _COMSOCK_H</span>
<a name="l00012"></a>00012 <span class="preprocessor"></span><span class="preprocessor">#define _COMSOCK_H</span>
<a name="l00013"></a>00013 <span class="preprocessor"></span>
<a name="l00014"></a>00014 <span class="comment">/* -= TIPI =- */</span>
<a name="l00015"></a>00015 
<a name="l00017"></a><a class="code" href="comsock_8h.html#ad7871643c05865c80f5d8050aead2b57">00017</a> <span class="preprocessor">#define MAXBUF 2048</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span>
<a name="l00026"></a><a class="code" href="structmessage__t.html">00026</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>{
<a name="l00028"></a><a class="code" href="structmessage__t.html#a2088bcda29404ae1e84f99388bee473f">00028</a>     <span class="keywordtype">char</span> <a class="code" href="structmessage__t.html#a2088bcda29404ae1e84f99388bee473f">type</a>;           
<a name="l00030"></a><a class="code" href="structmessage__t.html#ae42a6394ce558e3e54470afd3862d9db">00030</a>     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="structmessage__t.html#ae42a6394ce558e3e54470afd3862d9db">length</a>; 
<a name="l00032"></a><a class="code" href="structmessage__t.html#a670e35a55f39260aab8a626b6ba04e82">00032</a>     <span class="keywordtype">char</span> buffer[<a class="code" href="comsock_8h.html#ad7871643c05865c80f5d8050aead2b57">MAXBUF</a>];        
<a name="l00033"></a>00033 } <a class="code" href="structmessage__t.html">message_t</a>; 
<a name="l00034"></a>00034 
<a name="l00036"></a><a class="code" href="comsock_8h.html#a7baab2aa5bf8eb14b6128e0f16634837">00036</a> <span class="preprocessor">#define UNIX_PATH_MAX    108</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span>
<a name="l00039"></a><a class="code" href="comsock_8h.html#a75fe5caf5e2ff4d23a80103f78522077">00039</a> <span class="preprocessor">#define MAXTRIAL 10</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span>
<a name="l00041"></a><a class="code" href="comsock_8h.html#acc8a34cd623ae771fbde52003c68b66e">00041</a> <span class="preprocessor">#define MAXSEC 10</span>
<a name="l00042"></a>00042 <span class="preprocessor"></span>
<a name="l00044"></a><a class="code" href="comsock_8h.html#ae8d18b9066459a019d8e091fa929f747">00044</a> <span class="preprocessor">#define NTRIAL 3</span>
<a name="l00045"></a>00045 <span class="preprocessor"></span>
<a name="l00046"></a><a class="code" href="comsock_8h.html#aa47186c9efea8899b8c1c33314071f26">00046</a> <span class="preprocessor">#define NSEC 1</span>
<a name="l00047"></a>00047 <span class="preprocessor"></span>
<a name="l00050"></a><a class="code" href="comsock_8h.html#abe9a795da4c8ef9d50edace5ed7aa8af">00050</a> <span class="preprocessor">#define MSG_QUERY        &#39;Q&#39; </span>
<a name="l00051"></a>00051 <span class="preprocessor"></span>
<a name="l00052"></a><a class="code" href="comsock_8h.html#a32ee7130b0d9855c703edd428790e506">00052</a> <span class="preprocessor">#define MSG_LOAN         &#39;L&#39; </span>
<a name="l00053"></a>00053 <span class="preprocessor"></span>
<a name="l00054"></a><a class="code" href="comsock_8h.html#a9afc09ab327968a17c1f5589aae420e3">00054</a> <span class="preprocessor">#define MSG_RECORD       &#39;R&#39; </span>
<a name="l00055"></a>00055 <span class="preprocessor"></span>
<a name="l00056"></a><a class="code" href="comsock_8h.html#a4ff2533d4f42b5b10b6caf648a4619b4">00056</a> <span class="preprocessor">#define MSG_OK           &#39;K&#39; </span>
<a name="l00057"></a>00057 <span class="preprocessor"></span>
<a name="l00058"></a><a class="code" href="comsock_8h.html#a3e255ce553a2f6e3c33806adf8c997aa">00058</a> <span class="preprocessor">#define MSG_NO           &#39;N&#39; </span>
<a name="l00059"></a>00059 <span class="preprocessor"></span>
<a name="l00060"></a><a class="code" href="comsock_8h.html#aa8a990825a5a62c89d2fb8b08d8a1070">00060</a> <span class="preprocessor">#define MSG_ERROR        &#39;E&#39; </span>
<a name="l00061"></a>00061 <span class="preprocessor"></span>
<a name="l00062"></a>00062 
<a name="l00063"></a>00063 
<a name="l00064"></a>00064 <span class="comment">/* -= FUNZIONI =- */</span>
<a name="l00074"></a>00074 <span class="keywordtype">int</span> <a class="code" href="comsock_8c.html#ab4f598fd4b9d510f1feae85436ef9ebc">createServerChannel</a>(<span class="keywordtype">char</span>* path);
<a name="l00075"></a>00075 
<a name="l00083"></a>00083 <span class="keywordtype">int</span> <a class="code" href="comsock_8c.html#a36c68f60410ffdbb559bb256959def46">closeServerChannel</a>(<span class="keywordtype">char</span>* path, <span class="keywordtype">int</span> s);
<a name="l00084"></a>00084 
<a name="l00091"></a>00091 <span class="keywordtype">int</span> <a class="code" href="comsock_8c.html#a870654a1e9b336f13271a7cfa0836920">acceptConnection</a>(<span class="keywordtype">int</span> s);
<a name="l00092"></a>00092 
<a name="l00104"></a>00104 <span class="keywordtype">int</span> <a class="code" href="comsock_8c.html#a7342cc411ed1bd599f84d90d13ef4d86">receiveMessage</a>(<span class="keywordtype">int</span> <a class="code" href="bibserver_8c.html#aa462bab367c8aac56ebc986ad8f4e30c">sc</a>, <a class="code" href="structmessage__t.html">message_t</a> * <a class="code" href="bibclient_8c.html#a1bac7c8cafc9909ba9c076214a6b0c0b">msg</a>);
<a name="l00105"></a>00105 
<a name="l00115"></a>00115 <span class="keywordtype">int</span> <a class="code" href="comsock_8c.html#aa4a2380316658b900ce7086466887c4f">sendMessage</a>(<span class="keywordtype">int</span> <a class="code" href="bibserver_8c.html#aa462bab367c8aac56ebc986ad8f4e30c">sc</a>, <a class="code" href="structmessage__t.html">message_t</a> *<a class="code" href="bibclient_8c.html#a1bac7c8cafc9909ba9c076214a6b0c0b">msg</a>);
<a name="l00116"></a>00116 
<a name="l00129"></a>00129 <span class="keywordtype">int</span> <a class="code" href="comsock_8c.html#a88e5df18d7721b744bed4208fc97c3bb">openConnection</a>(<span class="keywordtype">char</span>* path, <span class="keywordtype">int</span> ntrial, <span class="keywordtype">int</span> k);
<a name="l00130"></a>00130 
<a name="l00137"></a>00137 <span class="keywordtype">int</span> <a class="code" href="comsock_8c.html#a730d0b220efe4930f0793030846efa52">closeConnection</a>(<span class="keywordtype">int</span> s);
<a name="l00138"></a>00138 
<a name="l00139"></a>00139 
<a name="l00140"></a>00140 <span class="comment">/*Funzione aggiunta*/</span>
<a name="l00141"></a>00141 
<a name="l00142"></a>00142 
<a name="l00143"></a>00143 <span class="keywordtype">int</span> message_setup(<a class="code" href="structmessage__t.html">message_t</a> *<a class="code" href="bibclient_8c.html#a1bac7c8cafc9909ba9c076214a6b0c0b">msg</a>,<span class="keywordtype">char</span>* <span class="keywordtype">string</span>, <span class="keywordtype">char</span> type);
<a name="l00144"></a>00144 
<a name="l00145"></a>00145 <span class="preprocessor">#endif</span>
</pre></div></div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Fri Jun 29 2012 10:36:44 for BIBLIO by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>
